package NG::Gen::Users::Index;
use strict;
use warnings;
use utf8;

use NG::Sys::App;
use NG::Sys::Datetime;

sub index_after_create {
	my $self = shift;
	my $res;
	my $ls = unixtime2timestamp(time() + app->constant->init_search_timeout);
	my $la = unixtime2timestamp(time() + app->constant->init_attack_timeout);
	$self->update_data({
			s_cat => $self->category,
			last_search => $ls,
			can_search => 1,
			last_attack => $la,
			can_attack => 0,
			random => rand(),
		});
}
sub make_searched{
	my $self = shift;
	my $ls = unixtime2timestamp();
	$self->update_data({
			last_search => $ls,
			can_search => 0,
			random => rand(),
		});
}
sub make_attacked{
	my $self = shift;
	my $ls = unixtime2timestamp();
	$self->update_data({
			last_search => $ls,
			can_search => 1,
			last_attack => $ls,
			can_attack => 0,
		});
}

1;
